<template>
  <div id="meeting">
    <h3>{{title}}</h3>
    <h4>{{time}}</h4>
    <br/>

    <el-container v-for="i in reply">
      <el-aside>{{i.user}}<br/>{{i.time}}</el-aside><el-main>{{i.content}}</el-main>
    </el-container>

    <el-input v-model="input" placeholder="回复"/>
    <el-button @click="send()">发送</el-button>
  </div>
</template>

<script>

  export default {
    data(){
      return{
        title:"议  题",
        time:"2022年6月26日11点10分",
        input:"",
        reply:[{user:'张三',content:'我就讲三点…',time:'2022年6月27日15点32分'},
          {user:'张三',content:'我就讲三点…',time:'2022年6月27日15点32分'},
          {user:'张三',content:'我就讲三点…',time:'2022年6月27日15点32分'}]
      }
    },
    methods:{
      getSQL(){
        let that = this;
        this.$axios.get("/api/getTime").then(function (res) {
          that.time = res.data
        });
        this.$axios.get("/api/getTitle").then(function (res) {
          that.title = res.data
        });
        this.$axios.get("/api/getReply").then(function (res) {
          that.reply = res.data
        });
      },
      send: function () {
        if (!this.input) {
          this.$message({type: 'warning', message: "请输入内容"});
          return;
        }
        this.$axios.get("/api/doReply/" + this.input);
        this.getSQL();
        this.input = ''
      },
    },
    created(){
      this.getSQL()
    },
  }
</script>

<style>
</style>
